package server

import (
	"fmt"
	"os"
	"path/filepath"
	"stforum/global"
)

func StartInitServer() {
	static_path, _ := os.Getwd()
	static_path = filepath.Join(static_path, "data", "static")
	BindStaticRouter(static_path, global.MainServer)
	//绑定安装路由
	global.MainServer.POST("/api/install", InstallRoute)
	var port string
	fmt.Print("请输入安装服务器启动端口:")
	fmt.Scanf("%s", &port)
	err := global.MainServer.Run("0.0.0.0:" + port)
	if err != nil {
		global.Logger.Error("安装服务器启动失败：", err.Error())
		os.Exit(1)
	}
}
